package com.xirui.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xirui.bean.Dormitory;
import com.xirui.bean.Floor;
import com.xirui.bean.Record;
import com.xirui.bean.User;
import com.xirui.mapper.DorMapper;
import com.xirui.service.DorService;

@Service
public class DorServiceImpl implements DorService{

	
	@Autowired
	private DorMapper dorMapper;

	public User login(User user) {
		
		return dorMapper.login(user);
	}

	public PageInfo<Record> YHlinked(Integer pageNum, Integer uid) {
		PageHelper.startPage(pageNum, 2);
		List<Record> list=dorMapper.YHlinked(uid);
		
		return new PageInfo<Record>(list);
	}

	public Record selectR(Integer uid) {
		
		return dorMapper.selectR(uid);
	}

	public PageInfo<Dormitory> GLlinked(Integer pageNum, Dormitory dor) {
		PageHelper.startPage(pageNum, 2);
		List<Dormitory> list=dorMapper.GLlinked(dor);
		
		return new PageInfo<Dormitory>(list);
	}

	public List<Floor> selectF() {
		
		return dorMapper.selectF();
	}

	public Record selectR2(Integer did) {
		
		return dorMapper.selectR2(did);
	}

	public List<Floor> liandongF() {
		
		return dorMapper.liandongF();
	}

	public List<Dormitory> liandongD(Integer fid) {
		
		return dorMapper.liandongD(fid);
	}

	public List<User> selectU() {
		
		return dorMapper.selectU();
	}

	public void updateOutTime(Integer uid, Date date) {
		
		dorMapper.updateOutTime(uid, date);
	}

	public void addR(Integer uid, Integer did) {
		
		dorMapper.addR(uid,did);
		
	}
	
	
	
	
}
